package com.xhtt.modules.photo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xhtt.modules.photo.dao.PhotoProductMapper;
import com.xhtt.modules.photo.entity.PhotoProduct;
import com.xhtt.modules.photo.entity.PhotoStage;
import com.xhtt.modules.photo.service.IPhotoProductService;
import com.xhtt.modules.photo.service.IPhotoStageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 现场拍照产品列表库 服务实现类
 * </p>
 *
 * @author xj
 * @since 2019-02-14
 */
@Service
public class PhotoProductServiceImpl extends ServiceImpl<PhotoProductMapper, PhotoProduct> implements IPhotoProductService {

    @Autowired
    private IPhotoStageService photoStageService;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void delete(Integer id) {

        // 删除产品表
        baseMapper.deleteById(id);

        // 删除装车台号表
        photoStageService.remove(new LambdaQueryWrapper<PhotoStage>().eq(PhotoStage::getProductId, id));


    }
}
